﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace KPIS.GERP.Models.HRM
{
    [DataContract, Table("hrm_ps_time_att_cal_audit")]
    public class PsTimeAttCalAudit
    {
        public PsTimeAttCalAudit()
        {
            ReCalculateWhen = DateTime.Now;
        }

        public PsTimeAttCalAudit(int year, int? month, int? jobSiteId, int? empTypeId, int clickCalculateBy, bool success, string remarks)
        {
            ReCalculateWhen = DateTime.Now;
            WorkingYear = year;
            WorkingMonth = month;
            ReCalculateByEmpId = clickCalculateBy;
            FilteredJobSiteId = jobSiteId;
            FilteredEmpTypeId = empTypeId;
            Success = success;
            Remarks = remarks;
        }

        [Key, DataMember, DatabaseGenerated(DatabaseGeneratedOption.Identity), Column("time_att_cal_audit_seq")]
        public int TimeAttCalAuditId { get; set; }

        [DataMember, Column("working_year")]
        public int WorkingYear { get; set; }

        [DataMember, Column("working_month")]
        public int? WorkingMonth { get; set; }

        [DataMember, Column("re_calculate_when")]
        public DateTime ReCalculateWhen { get; set; }

        [DataMember, Column("success")]
        public bool Success { get; set; }

        [DataMember, Column("remarks")]
        public string Remarks { get; set; }

        [DataMember, Column("re_calculate_by_emp_seq"), ForeignKey("ReCalculateByEmployee")]
        public int? ReCalculateByEmpId { get; set; }

        [DataMember, Column("filtered_job_site_seq"), ForeignKey("FilteredJobSite")]
        public int? FilteredJobSiteId { get; set; }

        [DataMember, Column("filtered_emp_type_seq"), ForeignKey("FilteredEmployeeType")]
        public int? FilteredEmpTypeId { get; set; }

        [DataMember]
        public virtual Employee ReCalculateByEmployee { get; set; }

        [DataMember]
        public virtual JobSite FilteredJobSite { get; set; }

        [DataMember]
        public virtual MasEmployeeType FilteredEmployeeType { get; set; }
    }
}